home *** CD-ROM | disk | FTP | other *** search
- #! /bin/csh -f
- #
- # $Id: ci-script,v 1.2 1992/10/27 10:10:30 carlson Exp carlson $
- #
- # ci-script Performs a ci on the file passed.
- #
- # Added functionality includes:
- # 1. Always performs default options $opt (defined in this script).
- # 2. Performs options found in environment variable RCSOPTS.
- # 3. Passes arguments from command line to ci.
- # 4. Performs options found in file .rcsopts.
- #
- # Revision History:
- # $Log: ci-script,v $
- # Revision 1.2 1992/10/27 10:10:30 carlson
- # When breaking out the options, break out three characters instead of
- # just two to allow checking of just the character following the dash.
- # Remove default options that conflict with command line options.
- #
- # Revision 1.1 91/08/27 13:13:01 carlson
- # Initial revision
- #
- #------------------------------------------------------------------------
- # Set default options for ci command here.
- #
- set opt = ( )
- if ( $?RCSOPTS ) then
- set opt = ( $opt $RCSOPTS )
- endif
- if ( -e ./.rcsopts ) then
- set x = ( `grep "^ci[ ]" ./.rcsopts` )
- if ( $#x > 1 ) set opt = ( $opt $x[2-] )
- endif
-
- #----
- # Scan for end of options in parameter list. We need to do this to
- # find where the file names start.
- #
- # While scanning, do the following:
- # 1. Remove any duplicated options from $opt.
- # 2. Remove any default options that conflict with user-specified
- # options on the command line.
- #
- # How it is done:
- # 1. set arg_chars to all of the characters in the argument separated
- # with spaces (so they are separate and distinct.
- # 2. If the argument does not start with a '-', we are done so we
- # quit the loop.
- # 3. If the argument is "--", then we are done but ci won't accept
- # this form so we have to remove it from argv.
- # ---
- # 4. Scan the default options for duplicate options or options that
- # are contradictory.
- # a. set opt_chars to all of the characters in the option
- # separated with spaces (so they are separate and
- # distinct).
- # b. If the option does not start with a '-', we are done
- # so we quit the loop.
- # c. If the option character is the same as the argument
- # character, remove the option.
- # d. If the option character is a contradictory character
- # to the argument, remove the option.
- #
- @ first = 1
-
- while ( $first <= $#argv )
- set arg_chars = ( `echo $argv[$first] | sed "s/\(.\)\(.\)\(.\)/\1 \2 \3/\\
- s/\(.\)\(.\)/\1 \2/"` )
- if ( "$arg_chars[1]" != "-" ) break
- if ( "$arg_chars[2]" == "-" ) then
- set argv[$first]
- break
- endif
- @ secnd = 1
- while ( $secnd <= $#opt )
- set opt_chars = ( `echo $opt[$secnd] | sed "s/\(.\)\(.\)\(.\)/\1 \2 \3/\\
- s/\(.\)\(.\)/\1 \2/"` )
- if ( "$opt_chars[1]" != "-" ) break
- if ( "$opt_chars[2]" == "$arg_chars[2]" ) set opt[$secnd]
- if ( "$opt_chars[2]" == "u" && "$arg_chars[2]" == "l" ) \
- set opt[$secnd]
- if ( "$opt_chars[2]" == 'l' && "$arg_chars[2]" == "u" ) \
- set opt[$secnd]
- @ secnd = $secnd + 1
- end
- @ first=$first + 1
- end
-
- #----
- # Check out files with arguments passed.
- #
- /usr/sbin/ci $opt $argv
-
- ### Local Variables:
- ### auto-fill-hook: nil
- ### End:
-